package com.adams.access.db.bean;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 
 * 
 * File Name : DicElement.java
 * 
 * @Description : 数据项定义
 */
@Entity
@Table(name = "T_ELEMENT_INFO")
public class DicElement implements Serializable
{

	private static final long serialVersionUID = 2536217210001661669L;

	private String elementcode = "";// 数据项编码

	private String elementname;// 数据项名称

	private String datatype;// 数据类型 S—字符型、N—数字型、D—日期型、T—时间型

	private String tablecode;// 数据项值集表

	private String codetype;// 编码格式类型 ０—无编码格式、１—顺序码、２—层码；

	private String codeformat;// 编码格式
	// 如果编码格式类别为层码，则输入格式如：3-3-3-3，如果是无编码和顺序码，则一般不输入；

	private String condition;// sql条件语句

	private Integer datalength;// 数据长度

	private Integer datadecimals;// 小数位

	@Id
	@GeneratedValue(generator = "assigned")
	@GenericGenerator(name = "assigned", strategy = "assigned")
	@Column(name = "ELEMENTCODE", length = 64)
	public String getElementcode()
	{
		return elementcode;
	}

	public void setElementcode(String elementcode)
	{
		this.elementcode = elementcode;
	}

	@Column(name = "ELEMENTNAME", length = 64)
	public String getElementname()
	{
		return elementname;
	}

	public void setElementname(String elementname)
	{
		this.elementname = elementname;
	}

	@Column(name = "DATATYPE", length = 64)
	public String getDatatype()
	{
		return datatype;
	}

	public void setDatatype(String datatype)
	{
		this.datatype = datatype;
	}

	@Column(name = "DATALENGTH")
	public int getDatalength()
	{
		return datalength;
	}

	public void setDatalength(int datalength)
	{
		this.datalength = datalength;
	}

	@Column(name = "DATADECIMALS")
	public int getDatadecimals()
	{
		return datadecimals;
	}

	public void setDatadecimals(int datadecimals)
	{
		this.datadecimals = datadecimals;
	}

	@Column(name = "TABLECODE", length = 64)
	public String getTablecode()
	{
		return tablecode;
	}

	public void setTablecode(String tablecode)
	{
		this.tablecode = tablecode;
	}

	@Column(name = "CODETYPE", length = 64)
	public String getCodetype()
	{
		return codetype;
	}

	public void setCodetype(String codetype)
	{
		this.codetype = codetype;
	}

	@Column(name = "CODEFORMAT", length = 64)
	public String getCodeformat()
	{
		return codeformat;
	}

	public void setCodeformat(String codeformat)
	{
		this.codeformat = codeformat;
	}

	@Column(name = "CONDITIONS", length = 255)
	public String getCondition()
	{
		return condition;
	}

	public void setCondition(String condition)
	{
		this.condition = condition;
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + elementcode.hashCode();
		return result;
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final DicElement other = (DicElement) obj;
		if (elementcode.equals(other.elementcode))
			return false;
		return true;
	}
}
